﻿<UserControl x:Class="PenguinPublishNS.Views.HostSettings"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:PenguinPublishNS" xmlns:models="clr-namespace:PenguinPublishNS.Models"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="600" Unloaded="UserControl_Unloaded_1">
    <Grid d:DataContext="{d:DesignInstance Type=models:HostServer}" Name="_grid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="187*"/>
            <ColumnDefinition Width="107*"/>
            <ColumnDefinition Width="320*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition
        Height="Auto" />
            <RowDefinition
        Height="Auto" MinHeight="25" />
            <RowDefinition
        Height="9*" />
            <RowDefinition
        Height="9*" />
            <RowDefinition Height="9*"/>
            <RowDefinition Height="9*"/>
            <RowDefinition Height="9*"/>
            <RowDefinition Height="9*"/>
            <RowDefinition Height="9*"/>
            <RowDefinition Height="9*"/>
            <RowDefinition Height="9*"/>
        </Grid.RowDefinitions>
        <TextBox x:Name="txtHostName"
      Grid.Row="1" Grid.Column="2" Margin="10,0,0,10" Text="{Binding hostName, Mode=TwoWay}" />
        <Label Content="Host settings for publishing" HorizontalAlignment="Left" Margin="40,0,0,0" VerticalAlignment="Top" FontWeight="Bold" FontSize="18" Height="39" Width="261" Grid.ColumnSpan="3"/>
        <Image HorizontalAlignment="Left" Height="38" Margin="0,1,0,0" VerticalAlignment="Top" Width="35" Source="/PenguinPublish;component/Images/32x32_web_secure.png"/>
        <Label Content="Host Name" Grid.Column="1" HorizontalAlignment="Left" Height="28" Margin="10,0,0,0" Grid.Row="1" VerticalAlignment="Top" Width="84"/>
        <Label Content="Host Address" Grid.Column="1" HorizontalAlignment="Left" Height="24" Margin="10,0,0,0" Grid.Row="2" VerticalAlignment="Top" Width="84"/>
        <TextBox x:Name="txtIPaddress"
        	Margin="10,0,132,8" Text="{Binding HostAddress, NotifyOnValidationError=True}" LostFocus="txtIPaddress_LostFocus" Grid.Column="2" Grid.Row="2" Width="170" HorizontalAlignment="Left" VerticalAlignment="Top" />
        <Label Content="Private Key" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,0,0,0" Grid.Row="3" VerticalAlignment="Top" Width="84"/>
        <TextBox Grid.Column="2" Margin="10,0,0,7" Grid.Row="3" TextWrapping="Wrap" Text="{Binding privateKey, Mode=TwoWay}"/>
        <Label Content="Key Passphrase" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,0,0,0" Grid.Row="4" VerticalAlignment="Top" Width="94"/>
        <TextBox Grid.Column="2" Margin="10,0,0,9" Grid.Row="4" TextWrapping="Wrap" Text="{Binding keyPassphrase}"/>
        <Label Content="Username" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,0,0,0" Grid.Row="5" VerticalAlignment="Top" Width="84"/>
        <TextBox Grid.Column="2" Margin="10,0,0,10" Grid.Row="5" TextWrapping="Wrap" Text="{Binding username}"/>
        <Label Content="Password" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,0,0,0" Grid.Row="6" VerticalAlignment="Top" Width="84"/>
        <TextBox Grid.Column="2" Margin="10,0,0,11" Grid.Row="6" TextWrapping="Wrap" Text="{Binding password}"/>
        <Label Content="Site Path" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,0,0,0" Grid.Row="7" VerticalAlignment="Top" Width="84"/>
        <TextBox Grid.Column="2" Margin="10,0,0,8" Grid.Row="7" TextWrapping="Wrap" Text="{Binding sitePath}"/>
        <Label Content="Destination URL" Grid.Column="1" HorizontalAlignment="Left" Height="23" Grid.Row="8" VerticalAlignment="Top" Width="94" Margin="10,0,0,0"/>
        <TextBox Grid.Column="2" Margin="10,0,0,8" Grid.Row="8" TextWrapping="Wrap" Text="{Binding destinationURL}"/>
        <Label Content="Last Published" Grid.Column="1" HorizontalAlignment="Left" Height="26" Margin="10,0,0,0" Grid.Row="10" VerticalAlignment="Top" Width="86"/>
        <TextBox Grid.Column="2" Margin="10,0,0,20" Grid.Row="10" TextWrapping="Wrap" Text="{Binding lastPublished}" IsTabStop="False" IsEnabled="False"/>
        <TextBox x:Name="txtHostId" HorizontalAlignment="Left" Height="18" Margin="0,18,0,-10" Grid.Row="10" TextWrapping="Wrap" VerticalAlignment="Top" Width="187" Text="{Binding hostId}" IsEnabled="False" Visibility="Hidden"/>
        <Label Content="Use Private Key" Grid.Column="1" HorizontalAlignment="Left" Height="23" Grid.Row="9" VerticalAlignment="Top" Width="94" Margin="10,0,0,0"/>
        <CheckBox Content="Uses PPK by default for connect" Grid.Column="2" HorizontalAlignment="Left" Height="14" Margin="10,5,0,0" Grid.Row="9" VerticalAlignment="Top" Width="197" IsChecked="{Binding usePPK}"/>
        <UniformGrid Grid.Row="2" Grid.RowSpan="7" Margin="10,3,10,10" Rows="4" Columns="1">
            <Button x:Name="btnAddNew" Content="Add New" Height="27" Width="59" Click="btnAddNew_Click" IsTabStop="False" VerticalAlignment="Top" Margin="0" HorizontalAlignment="Center"/>
            <Button x:Name="btnValidate" Content="Validate Setting" Height="28" Width="88" IsTabStop="False" VerticalAlignment="Top" Margin="0" HorizontalAlignment="Center" Click="btnValidate_Click"/>
            <Button x:Name="btnSaveSetting" Content="Save Setting" Height="28" Width="79" Click="btnSaveSetting_Click" IsTabStop="False" VerticalAlignment="Top" Margin="0" HorizontalAlignment="Center"/>
            <Button x:Name="btnDelete" Content="Delete" Height="28" Width="49" Click="btnDelete_Click" IsTabStop="False" VerticalAlignment="Top" Margin="0" HorizontalAlignment="Center"/>
        </UniformGrid>
        <CheckBox x:Name="chkHostValid" Content="Host Connection Valid" HorizontalAlignment="Left" Height="17" Margin="35,5,0,0" Grid.Row="9" VerticalAlignment="Top" Width="152" IsChecked="{Binding sftpValid}" IsEnabled="False"/>
        <TextBlock HorizontalAlignment="Left" Height="19" Margin="23,1,0,0" Grid.Row="10" TextWrapping="Wrap" Text="Settings save on close" VerticalAlignment="Top" Width="164" Foreground="#FFB41BC3"/>
        <TextBlock x:Name="txtNoNetwork" Grid.Column="2" HorizontalAlignment="Left" Height="24" Margin="23,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="257" Foreground="Red" FontSize="16" FontWeight="Bold"/>
        <CheckBox x:Name="chkValidIP" Content="Ping Success" Height="18" VerticalAlignment="Top" Margin="203,3,0,0" IsChecked="{Binding ipAvailable}" IsEnabled="False" Grid.Column="2" Grid.Row="2" HorizontalAlignment="Left" Width="100"/>
        <ComboBox x:Name="cboHostNames" SelectedValuePath="hostId" DisplayMemberPath="hostName" SelectedIndex="0" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Width="157" ItemsSource="{Binding hostName}" SelectionChanged="cboHostNames_SelectionChanged" Margin="16,0,0,0" Grid.Row="1" Loaded="cboHostNames_Loaded"/>
    </Grid>
</UserControl>
